<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="page"  uri="http://www.aptech.com/pager"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>后台管理系统</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
	content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
<meta name="author" content="Muhammad">

<link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
<script src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
body {
	padding-bottom: 40px;
}
.sidebar-nav {
	padding: 9px 0;
}
.detailTD{text-align:right;width:180px;height:30px;}
#download{
 text-align:right;
 float:right;
}
</style>
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
	  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->

<link rel="shortcut icon" href="img/favicon.ico">
</head>
<body>
<jsp:include page="/referencesHtml/jsAndCss.html"></jsp:include>
	<s:include value="/header.jsp" />
	<!-- topbar ends -->
	<div class="container-fluid">
		<div class="row-fluid">
			<s:include value="/left.jsp" />
			<div id="content" class="span10">
				<!-- content starts -->
				<div>
					<ul class="breadcrumb">
						<li><a href="index">主页</a> <span class="divider">/</span></li>
						<li><a href="#">网点数据统计</a></li>
						<li id="download"><a href="statistics!getExcel" class="download" >导出表格</a></li>
					</ul>
				</div>
				<div class="row-fluid sortable ui-sortable">
					<div class="box span12" style="margin-top:0px;">
						<div class="box-header well" data-original-title="">
							<h4><i class="icon-edit"></i>搜索</h4>
						</div>
						<div class="box-content">
							<div style="width: 100%; height: 30px;">
								<div
									style="width: 65px; float: left; text-align: right; padding-top: 8px;">
									<label class="control-label" for="typeahead">开始时间:</label>
								</div>
								<div style="width: 30%; float: left;">
									&nbsp;&nbsp;<input type="text" class="timesofpackage Wdate"
										id="starttime" data-items="2"
										onfocus="WdatePicker({dateFmt:'yyyy-MM-dd  HH:mm:ss',onpicked:function(){timechange();},oncleared:function(){clearTimes();}})" />
								</div>
								<div
									style="width:80px; float: left; text-align: right; padding-top: 8px;">
									<label class="control-label" for="typeahead">- 结束时间：</label>
								</div>
								<div style="width: 55%; float: left;">
									<input type="text" class="timesofpackage Wdate" id="endtime"
										data-items="2"
										onfocus="WdatePicker({dateFmt:'yyyy-MM-dd  HH:mm:ss',onpicked:function(){timechange();},oncleared:function(){clearTimes();}})" />
										<input type="button" id="searchTerm"  class="btn btn-primary" value="查&nbsp;&nbsp;&nbsp;&nbsp;询" style="margin-left:50px;margin-bottom:10px;"/>
								</div>
								<div class="control-group" style="clear:both;">
		                     <input type="button" id="monthData"  class="btn btn-primary" value="最近30天数据统计" style="float: left;margin-top:10px;width:150px;margin-left:150px;margin-bottom:10px;"/>
		                     <input type="button" id="weekData"  class="btn btn-primary" value="最近7天数据统计" style="float: left;margin-top:10px;width:150px;margin-left:150px;margin-bottom:10px;"/>
		                     <input type="button" id="dayData"  class="btn btn-primary" value="今日数据统计" style="float: left;margin-top:10px;width:150px;margin-left:150px;margin-bottom:10px;"/>
		                   </div>
							</div>
						</div>
					</div>
					</div>
					<div id="dataContent">
					<div class="sortable row-fluid ui-sortable">
					<div class="box span12">
						<input id="sTime" value="${basicData.sTime}" type="text" style="display: none;"/>
						<input id="eTime" value="${basicData.eTime}" type="text" style="display: none;"/>
						<div class="box-header well" data-original-title="" id="betweenTime">
							<h2>
								<i class="icon-edit"></i> 本段时间基础数据     (${basicData.sTime}----${basicData.eTime})
							</h2>
						</div>
						<div class="box-content">
							<table style="width:100%">
                             <tbody>
                                <tr>
                                   <td class="detailTD"><label class="control-label" for="typeahead">总包裹数:</label></td>
                                   <td><input value="<s:property value="basicData.totalParcel" />件" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                   <td class="detailTD"><label class="control-label" for="typeahead">正常取走数:</label></td>
                                   <td><input value="<s:property value="basicData.takenParcel" />件" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                </tr>
                                <tr>
                                   <td class="detailTD"><label class="control-label" for="typeahead">未取包裹数:</label></td>
                                   <td><input value="<s:property value="basicData.unTakenParcel" />件" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                   <td class="detailTD"><label class="control-label" for="typeahead">处理数:</label></td>
                                   <td><input value="<s:property value="basicData.dealParcel" />件" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                </tr>
                                <tr>
                                   <td class="detailTD"><label class="control-label" for="typeahead">总箱格数:</label></td>
                                   <td><input value="<s:property value="basicData.totalBox" />个" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                   <td class="detailTD"><label class="control-label" for="typeahead">总使用率:</label></td>
                                   <td><input value="<s:property value="basicData.totalUseRate" />次/个/日" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                </tr>
                                <tr>
                                   <td class="detailTD"><label class="control-label" for="typeahead">超大箱格数:</label></td>
                                   <td><input value="<s:property value="basicData.superBoxNum" />个" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                   <td class="detailTD"><label class="control-label" for="typeahead">大箱格数:</label></td>
                                   <td><input value="<s:property value="basicData.bigBoxNum" />个" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                </tr>
                                <tr>
                                   <td class="detailTD"><label class="control-label" for="typeahead">中箱格数:</label></td>
                                   <td><input value="<s:property value="basicData.mediumBoxNum" />个" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                   <td class="detailTD"><label class="control-label" for="typeahead">小箱格数:</label></td>
                                   <td><input value="<s:property value="basicData.smallBoxNum" />个" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                </tr>
                                <tr>
                                   <td class="detailTD"><label class="control-label" for="typeahead">设备数:</label></td>
                                   <td><input value="<s:property value="basicData.terminalNum" />台" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                   <td class="detailTD"><label class="control-label" for="typeahead">设备网点数:</label></td>
                                   <td><input value="<s:property value="basicData.branchNum" />个" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                </tr>
                                <tr>
                                   <td class="detailTD"><label class="control-label" for="typeahead">统计天数:</label></td>
                                   <td><input value="<s:property value="basicData.totalDay" />天" readonly="readonly" type="text" class="span4 typeahead " style="width:250px;" data-items="2" /></td>
                                   <td class="detailTD"><label class="control-label" for="typeahead"></label></td>
                                   <td><input id="companyData" value="本时段各快递公司使用情况" type="button" class="btn btn-primary" style="float: left;margin-top:10px;width:200px;margin-bottom:10px;" /></td>
                                </tr>
                             </tbody>
                           </table>
						</div>
					</div>
				</div>
				<div class="row-fluid sortable ui-sortable">
					<div class="box span12" style="margin-bottom: 30px;margin-top:0px;">
						<div class="box-header well" data-original-title="">
							<h4><i class="icon-edit"></i>各网点数据统计情况</h4>
						</div>
						<div class="box-content">
						<div class="row-fluid packagepages" style="margin-top:20px;">
						<page:page pages="${branchData.allPage}" url="statistics!branchData" param="&startstime=${startstime}&endtime=${endtime}"
										curpage="${branchData.curpage}" pageIndex="7" total="${branchData.total}" pageSize="${branchData.pageSize }"/>
							<table
								class="table table-striped table-bordered bootstrap-datatable dataTable" id="dateTable">
								<thead>
									<tr role="row">
										<th class="sorting_asc" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">序号</th>
										<th class="sorting_asc" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">网点地址</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">设备数量</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">箱格总数</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">包裹总数</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">滞留1天</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">滞留3天</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">滞留5天</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">箱格使用率</th>
										<th class="sorting" role="columnheader" tabindex="0"
											aria-controls="DataTables_Table_0" rowspan="1" colspan="1">操作</th>
									</tr>
								</thead>
		
								<tbody>
									<s:if test="branchData.list.size()==0">
								    	<tr class="odd">
										  <td colspan="9">=_= 没有找到任何记录！</td>
										</tr>
								       </s:if>
									<s:iterator value="branchData.list" var="data" status="st">
										<tr class="odd">
											<td class="center "><s:property value="#st.index+1" /></td>
											<td class="center "><s:property value="#data.branch.branchShortAddress" /></td>
											<td class="center "><s:property value="#data.terminalNum" /></td>
											<td class="center "><s:property value="#data.totalBox" /></td>
											<td class="center "><s:property value="#data.totalParcel" /></td>
											<td class="center "><s:property value="#data.left1Day" /></td>
											<td class="center "><s:property value="#data.left3Day" /></td>
											<td class="center "><s:property value="#data.left5Day" /></td>
											<td class="center "><s:property value="#data.totalUseRate" />次/个/日</td>
											<td class="center "> 
												<a href="statistics!branchDataDetails?curpage=1&pageSize=10&flag=list&startstime=${startstime}&endtime=${endtime}&branchID=<s:property value="#data.branch.branchId" />">
													详情
												</a>
											</td>
										</tr>
									</s:iterator>
								</tbody>
							</table>
							<input type="hidden" value="${branchData.curpage}" id="curpage"/><input type="hidden" value="${branchData.pageSize }" id="pageSize"/>
							<page:page pages="${branchData.allPage}" url="statistics!branchData" param="&startstime=${startstime}&endtime=${endtime}"
										curpage="${branchData.curpage}" pageIndex="7" total="${branchData.total}" pageSize="${branchData.pageSize }"/>
							</div>
						</div>
					</div>
				</div>
				</div>
			</div>
		</div>
		<hr>
		<s:include value="/footer.jsp" />
	</div>
	<!-- jQuery -->
	<script src="js/layer/layer.js"></script>  
	<script type="text/javascript">
	/* $(function(){
		$("#betweenTime h2").append($("#sTime").val()+"----"+$("#eTime").val());
	}); */
	$("#searchTerm").live("click",function(){
		var pageSize = $("#pageSize").val();
		var start = $("#starttime").val();
		var end = $("#endtime").val();
		if(start==""){
			alert("请选择起始时间！");
			return;
		}
		if(end==""){
			alert("请选择结束时间！");
			return;
		}
		var lay = layer.load("<span style='color:blue;'>查询中，请稍后...</psan>");
		$.post("statistics!branchData?flag=time&curpage=1"
				+ "&pageSize=" + pageSize + "&startstime="
				+ start + "&endtime=" + end, function(v) {
			//alert(v);
			layer.close(lay);
			$("#dataContent").html(v);
		});
	});
	$("#monthData").live("click",function(){
		var lay = layer.load("<span style='color:blue;'>查询中，请稍后...</psan>");
		var pageSize = $("#pageSize").val();
		$.post("statistics!branchData?flag=monthData&curpage=1"
				+ "&pageSize=" + pageSize, function(v) {
			//alert(v);
			layer.close(lay);
			$("#dataContent").html(v);
		});
	});
	$("#weekData").live("click",function(){
		var lay = layer.load("<span style='color:blue;'>查询中，请稍后...</psan>");
		var pageSize = $("#pageSize").val();
		$.post("statistics!branchData?flag=weekData&curpage=1"
				+ "&pageSize=" + pageSize, function(v) {
			//alert(v);
			layer.close(lay);
			$("#dataContent").html(v);
		});
	});
	$("#dayData").live("click",function(){
		var lay = layer.load("<span style='color:blue;'>查询中，请稍后...</psan>");
		var pageSize = $("#pageSize").val();
		$.post("statistics!branchData?flag=dayData&curpage=1"
				+ "&pageSize=" + pageSize, function(v) {
			//alert(v);
			layer.close(lay);
			$("#dataContent").html(v);
		});
	});
	$("#companyData").live("click",function(){
		var startstime = $("#sTime").val();
		var endtime = $("#eTime").val();
		var url="statistics!agentCompanyData?curpage=1&pageSize=15&flag=list&startstime="+startstime+"&endtime="+endtime;
		window.showModalDialog(url,"Arguments","dialogHeight: 650px; dialogWidth: 1400px; dialogTop: 10px; dialogLeft: 10px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");  
	});
	</script>
</body>
</html>